Skip to main content

79.4 Separate @Entity Definitions from Spring Configuration

79.4 从Spring配置分离@Entity定义

Spring Boot会基于它找到的@EnableAutoConfiguration来尝试猜测@Entity定义的位置,想要获取更多控制可以使用@EntityScan注解,比如:

@Configuration
@EnableAutoConfiguration
@EntityScan(basePackageClasses=City.class)
public class Application {

//...

}